-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tombstoning #598
Tombstoning #598
Conversation
ed3abb7
to
e480e34
Compare
e480e34
to
b12eca7
Compare
87d99ed
to
bbb35f6
Compare
The PR currently implements things like this: ---
title: Tombstone Consistency
config:
fontFamily: monospace
---
erDiagram
User {
int unix_account_id
str login
str login_hash "generated always as digest(login, 'sha512')"
}
UnixAccount {
int id
int uid
}
UnixTombStone {
int uid
str login_hash
}
User |o--o| UnixAccount: "user_unix_account_id_fkey"
User ||--o| UnixTombStone: "user_login_hash_fkey"
UnixAccount ||--o| UnixTombStone: "unix_account_uid_fkey"
One new important change would be that even though unix accounts without corresponding user are allowed, deleting the |
Unfortunately, I cannot naturally create a cascade which deletes the |
Not true, I can just instruct sqlalchemy to issue the deletes by adding |
This encompasses - A generated column `User.login_hash` - An FKey User→UnixTombstone - An FKey UnixAccount→UnixTombstone - Partial indices on the UnixTombstone table to ensure a composite nullable key with optional components, but with equality - A trigger updating the user's tombstone if a UnixAccount is inserted
First, setting `echo=True` on the engine has the disadvantage that logs are emitted internally _and_ to stdout, leading to double reporting. Furthermore, we now have a cascade of three levels 1. no verbosity (0): no logs emitted. 2. `-v` (1): statement logs are emitted, but not results – and only displayed by pytest on failure. 3. `-vv` (2): both statement logs and result rows are emitted, also on failure.
75e94f7
to
851c325
Compare
This has been deprecated in v0.7 because `execute_if` already subsumes this functionality; see https://github.com/sqlalchemy/sqlalchemy/blob/f6198d9abf453182f4b111e0579a7a4ef1614e79/lib/sqlalchemy/sql/ddl.py#L314-L316. We already use that on the event registration when `dialect` is set.
Some mis-attribution of things as `hybrid_property` caused the sphinx lookup of the respective attributes on the class to fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't do an in-depth review currently but the changes look good for me.
The first thing one should see is the actual test, not details regarding the setup. This follows the general suggestion to place the high-level functions on the top, and the functions which are dependencies more towards the bottom.
772d387
to
de80e90
Compare
de80e90
to
089fabc
Compare
@ibot3 FYI there was something I overlooked: testing that the "is login available" logic does the correct thing if the login is not taken, but a tombstone exists. See ebe6fb8 and I made the decision to make no user-facing distinction and presenting it as before, as "login is already taken". |
Required for the `alembic diff` custom flask cli command
Sorry for the abhorrent schema migration, but that's the way it is. |
This is already covered in other tests
This is necessary to not break commands like `create-model`. In prod, the flag should of course be set to `True`.
Ignoring the |
ON DELETE SET NULL
touser→unix_account
(since theunix_account
now does not serve as tombstone anymore) and ensure user deletion causes unix_account deletionunix_accounts
without auser
(the ldap_exporter ignores them, anyway) (answer: automatically delete the unix account on user deletion, but technically allow them)mermaid.js